home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Frameworks
/
Sprocket Framework DR2
/
Sprocket Framework
/
SplashWindow.cp
< prev
next >
Wrap
Text File
|
1996-06-15
|
3KB
|
117 lines
/*
File: SplashWindow.cp
Project: Sprocket Framework 1.1 (DR2), released 6/15/96
Contains: Sub-class of TWindow which handles a splash screen
To Do: This may become optional in future Sprockets
Sprocket Major Contributors:
----------------------------
Dave Falkenburg, producer of Sprocket 1.0
Bill Hayden, producer of Sprocket 1.1
Steve Sisak, producer of the upcoming Sprocket 2.0
Pete Alexander Steve Falkenburg Randy Thelen
Eric Berdahl Nitin Ganatra Chris K. Thomas
Marshall Clow Dave Hershey Leonard Rosenthal
Tim Craycroft Dave Mark Dean Yu
David denBoer Gary Powell
Cameron Esfahani Jon Summers Apple Computer, Inc.
Comments, Additions, or Corrections:
------------------------------------
Bill Hayden, Nikol Software <nikol@codewell.com>
*/
#include "SprocketConstants.h"
#include "SplashWindow.h"
#include "UString.h"
#include <ToolUtils.h>
TSplashWindow::TSplashWindow()
{
this->CreateWindow(kNormalWindow);
pcpy(fStatus, "\pStarting up…");
}
TSplashWindow::~TSplashWindow()
{
if (fSplashPicture)
ReleaseResource((Handle)fSplashPicture);
this->Close();
}
WindowRef TSplashWindow::MakeNewWindow(WindowRef behindWindow)
{
GrafPtr oldPort;
Rect windowRect;
WindowRef splashWindow;
GetPort(&oldPort);
fSplashPicture = GetPicture(kSplashPictureID);
if (fSplashPicture)
{
MoveHHi((Handle) fSplashPicture); // get it out of the way
fSplashPictRect = (**fSplashPicture).picFrame;
}
else
SetRect(&fSplashPictRect, 0, 0, 0, 0);
// normalize the rectangle
OffsetRect(&fSplashPictRect, -fSplashPictRect.left, -fSplashPictRect.top);
// center it on the main screen
fStatusRect = fSplashPictRect;
fStatusRect.top = fStatusRect.bottom + 6;
fStatusRect.bottom += 18;
InsetRect(&fStatusRect, 6, 0);
windowRect = fSplashPictRect;
windowRect.bottom += 24;
OffsetRect(&windowRect,((qd.screenBits.bounds.right-windowRect.right) >> 1),((qd.screenBits.bounds.bottom-windowRect.bottom) >> 1));
splashWindow = NewColorOrBlackAndWhiteWindow(nil,&windowRect,(StringPtr) "\p",false,dBoxProc,behindWindow,false,(long) this);
ShowWindow(splashWindow);
SetPort(oldPort);
return splashWindow;
}
void TSplashWindow::Draw()
{
//BeginUpdate(fWindow); // avoid a flashing update event later
SetPortWindowPort(fWindow);
TextFont(geneva);
TextSize(9);
TextFace(bold);
TETextBox(&fStatus[0] + 1, fStatus[0], &fStatusRect, teCenter);
if (fSplashPicture)
DrawPicture(fSplashPicture, &fSplashPictRect);
//EndUpdate(fWindow); // avoid a flashing update event later
}
void TSplashWindow::NewStatus(StringPtr status)
{
pcpy(fStatus, status);
this->Draw();
}